#pragma once

#include "Shape.h"
#include "Rectangle.h"

class RectShape :public Shape,public Rectangle
{
private:
	int left, top;
public:
	RectShape(int left = 0, int top = 0, int width = 0, int height = 0) :Rectangle(width, height)
	{
		this->left = left;
		this->top = top;
	}
	virtual ~RectShape() {}

	int get_left() { return left; }
	void set_left(int left) { this->left = left; }

	int get_top() { return top; }
	void set_top(int top) { this->top = top; }

	int get_width() { return get_x(); }
	void set_width(int width) { set_x(width); }

	int get_height() { return get_y(); }
	void set_height(int height) { set_y(height); }

	void resize(int left, int top, int width, int height)
	{
		this->left = left;
		this->top = top;
		set_x(width);
		set_y(height);
	}

	virtual bool in(int x, int y) override
	{
		if (x >= left && x <= left + get_x() && y >= top && y <= top + get_y())
		{
			return true;
		}
		else
		{
			return false;
		}
	}
};